
var url = config.path + "/a/sys/area/app_areaData";
new Vue({
	el: '#app',
	data: {
		message: "Vue",
		active : 0,
		provinces: [],
		citys: [],
		provinceId: null,
		cityId: null,
		districtId: null
	},
	methods: {
		deptClick: function(idx, item) {
			var _this = this;
			this.active = idx;
			console.log(idx, item);
			this.provinceId = item.id
			$$.getJSON(url, {existId: item.id}, function(data) {
				//console.log(data);
				if(data.status.index == 10000){
					_this.citys = data.results;
				}

			})
		},
		subDeptClick: function (item) {
			var _this = this;
			this.cityId = item.id;
			Akuma.chooseCity(_this.provinceId, _this.cityId, _this.districtId);
		}
	},
	init:function() {
		var _this = this;
		var _default = [];
		$$.getJSON(url, {existId: 1}, function(data) {
			//console.log(data);
			if(data.status.index == 10000){
				_this.provinces = data.results;
				_default = data.results[0];
				$$.getJSON(url, {existId: _default.id}, function(data) {
					//console.log(data);
					if(data.status.index == 10000){
						_this.citys = data.results;
					}

				});
			}

		})
	}
});


